import request from "@/utils/request";

export const service = () => {
  // JSON.parse undefined会报错，加个默认值
  return !!JSON.parse(localStorage.$loginInfo || "{}").tenantId
    ? "/event"
    : "/ttevent";
};

const token = sessionStorage.getItem("authorization");

export function jumpShare(params) {
  return request({
    url: `/event/xcxToken`,
    method: "post",
    data: params,
  });
}

export function getDecryptOrderInfo(params) {
  return request({
    url: service() + `/alarm/order/getOrderInfo`,
    method: "post",
    data: params,
    headers: { Authorization: "Bearer " + token },
  });
}

/**
 * 新增告警分享
 * */
export function addShare(data) {
  return request({
    url: service() + "/alarm/share/addShare",
    method: "post",
    data: data,
  });
}
